﻿using System;
using System.Web.Mvc;
using System.Web.UI;

namespace Caching.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        //[OutputCache(Duration = 60, VaryByParam = "None")]
        //public ActionResult Index()
        //{
        //    ViewData["Message"] = "Caching in ASP.NET MVC";
        //    ViewData["CurrentTime"] = DateTime.Now.ToString();

        //    return View();
        //}

        //[OutputCache(Duration = 60,
        //    Location = OutputCacheLocation.Downstream,
        //    VaryByParam = "None")]
        //public ActionResult Index()
        //{
        //    ViewData["Message"] = "Caching in ASP.NET MVC";
        //    ViewData["CurrentTime"] = DateTime.Now.ToString();

        //    return View();
        //}

        //[OutputCache(Duration = 60, VaryByParam = "*")]
        //public ActionResult Index()
        //{
        //    ViewData["Message"] = "Caching in ASP.NET MVC";
        //    ViewData["CurrentTime"] = DateTime.Now.ToString();

        //    return View();
        //}

        //[OutputCache(Duration = 60,
        //    VaryByParam = "*",
        //    VaryByHeader = "Accept-Language")]
        //public ActionResult Index()
        //{
        //    ViewData["Message"] = "Caching in ASP.NET MVC";
        //    ViewData["CurrentTime"] = DateTime.Now.ToString();

        //    return View();
        //}

        //[OutputCache(Duration = 60, VaryByContentEncoding = "gzip")]
        //public ActionResult Index()
        //{
        //    ViewData["Message"] = "Caching in ASP.NET MVC";
        //    ViewData["CurrentTime"] = DateTime.Now.ToString();

        //    return View();
        //}

        //[OutputCache(CacheProfile = "Wrox")]
        //public ActionResult Index()
        //{
        //    ViewData["Message"] = "Caching in ASP.NET MVC";
        //    ViewData["CurrentTime"] = DateTime.Now.ToString();

        //    return View();
        //}

        [OutputCache(Duration = 90,
            Location = OutputCacheLocation.Server,
            VaryByParam = "None",
            VaryByHeader = "HTTP_REFERER")]
        public ActionResult Index()
        {
            ViewData["Message"] = "Caching in ASP.NET MVC";
            ViewData["CurrentTime"] = DateTime.Now.ToString();

            return View();
        }
    }
}
